import http from "@/api";
import qs from "qs";

/**
 * @name 变更管理模块
 */

// 变更统计
export const countChange = params => {
  return http.post(`/pages/change!changeFlotPieData.action`, qs.stringify(params), { loading: false });
};

// 变更列表
export const findPagerChange = params => {
  return http.post(`/pages/change!findPagerChange.action`, qs.stringify(params), { loading: false });
};

// 保存变更前检查
export const statCiChangeConflict = params => {
  return http.post(`/pages/change!statCiChangeConflict.action`, qs.stringify(params), { loading: false });
};

// 新增变更
export const saveChange = params => {
  return http.post(`/pages/change!saveChange.action`, qs.stringify(params), { loading: false });
};

// 变更模板
export const findByTemplateType = params => {
  return http.post(`/pages/template!findByTemplateType.action`, qs.stringify(params), { loading: false });
};

// 编辑变更
export const changeEdit = (ciIdsAndServiceDirectoryIds, params) => {
  return http.post(`/pages/change!editChange.action?${ciIdsAndServiceDirectoryIds}`, qs.stringify(params), { loading: false });
};

// 删除变更
export const deleteChange = params => {
  return http.post(`/pages/change!deleteChange.action`, qs.stringify(params), { loading: false });
};

// 变更详情
export const changeInfo = params => {
  return http.post(`/pages/clientChange!changeInfo.action`, qs.stringify(params), { loading: false });
};

// 变更计划
export const findEventEav = params => {
  return http.post(`/pages/eventEav!findEventEav.action`, qs.stringify(params), { loading: false });
};

// 变更审批
export const findAllApporveComment = params => {
  return http.post(`/pages/change!findAllApporveComment.action`, qs.stringify(params), { loading: false });
};

// 变更历史
export const findAllHistoryRecord = params => {
  return http.post(`/pages/historyRecord!findAllHistoryRecord.action`, qs.stringify(params), { loading: false });
};

// 变更关联请求
export const getChangeRelatedRequest = params => {
  return http.post(`/pages/change!getChangeRelatedRequest.action`, qs.stringify(params), { loading: false });
};

// 变更关联资产
// export const getChangeRelatedProblem = params => {
//   return http.post(`/pages/change!getChangeRelatedProblem.action`, qs.stringify(params), { loading: false });
// };

// 优先级列表/紧急度列表/影响列表/变更状态
export const findByCode = params => {
  return http.post(`/pages/dataDictionaryItems!findByCode.action`, qs.stringify(params), { loading: false });
};

// 变更分类
export const getCategoryTree = params => {
  return http.post(`/pages/event!getCategoryTree.action?num=50`, qs.stringify(params), { loading: false });
};

// 变更指派
export const changeAction = params => {
  return http.post(`/pages/clientChange!changeAction.action?num=50`, qs.stringify(params), { loading: false });
};

// 保存变更计划
export const editChangeBaseInfo = params => {
  return http.post(`/pages/change!editChangeBaseInfo.action`, qs.stringify(params), { loading: false });
};

// 关联的问题
export const getChangeRelatedProblem = params => {
  return http.post(`/pages/change!getChangeRelatedProblem.action`, qs.stringify(params), { loading: false });
};

// 关联资产
export const changeInfoNewPage = params => {
  return http.post(`/pages/change!changeInfoNewPage.action`, qs.stringify(params), { loading: false });
};

// 开启流程默认组
export const findProcessAssignDTO = params => {
  return http.post(`/pages/change!findProcessAssignDTO.action`, qs.stringify(params), { loading: false });
};

// 开启流程
export const openProcess = params => {
  return http.post(`/pages/change!openProcess.action`, qs.stringify(params), { loading: false });
};

// 变更任务重新指派
export const assignTask = params => {
  return http.post(`/pages/change!assignTask.action`, qs.stringify(params), { loading: false });
};

// 提交变更计划
export const processHandle = params => {
  return http.post(`/pages/change!processHandle.action`, qs.stringify(params), { loading: false });
};

// 所有变更实施完成
